package com.yuandian.business.monitor.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuandian.api.business_monitor.po.UsersOperationsParams;
import com.yuandian.api.business_monitor.vo.UserBusinessOperationsDetailVO;
import com.yuandian.api.business_monitor.vo.UserOperationsStatisticsVO;
import com.yuandian.api.business_monitor.vo.UserOperationsTrajectoryVO;
import com.yuandian.api.business_monitor.vo.UsersOperationsOverviewVO;
import com.yuandian.po.BaseSearch;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 用户告警查询
 * </p>
 *
 * @author zuokun
 * @since 2021-12-6
 */
@Mapper
public interface UserOperationsMapper {
	/**
	 * 查询用户操作概况
	 *
	 * @param params
	 * @return UsersOperationsOverview
	 */
	List<UsersOperationsOverviewVO> queryUsersOperationsOverview(Page<UsersOperationsOverviewVO> page,
																 @Param("params") UsersOperationsParams params);

	/**
	 * 查询XX用户操作统计
	 * 监控分析-用户操作回溯分析-查询XX用户操作统计
	 *
	 * @param params
	 * @return UsersOperationsOverview
	 */
	List<UserOperationsStatisticsVO> queryUserOperationsStatistics(Page<UserOperationsStatisticsVO> page,
																   @Param("params") UsersOperationsParams params);

	/**
	 * 应用系统-查询用户数
	 *
	 * @param search
	 * @return 用户数
	 */
	public int queryBusiUserCount(@Param("systemId") int systemId,
								  @Param("businessCode") String businessCode, @Param("params") BaseSearch search);


	/**
	 * 应用系统-查询异常用户数
	 *
	 * @param search
	 * @return 异常用户数
	 */
	public int queryBusiUserExcepitonCount(@Param("tableName") String tableName,
										   @Param("param") BaseSearch search, @Param("systemId") int systemId,
										   @Param("businessCode") String businessCode);

	/**
	 * 应用系统-判断表是否存在
	 *
	 * @param tableName
	 * @return
	 */
	int queryTableIfExsit(String tableName);

	//    @SqlAlias(value = "操作详情")
//    @DS("bpmData")

	/**
	 * 操作详情
	 *
	 * @param page   分页参数
	 * @param params 查询参数
	 * @return
	 */
	List<UserBusinessOperationsDetailVO> queryUserBusinessOperationsDetail(Page<UserOperationsStatisticsVO> page, @Param("params") UsersOperationsParams params);


	/**
	 * 查询用户操作轨迹
	 *
	 * @param params 查询参数
	 * @return
	 */
	List<UserOperationsTrajectoryVO> queryUserOperationsTrajectory(@Param("params") UsersOperationsParams params);
}
